package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Hotel extends BaseDomain{

    public static final Integer STATE_LUXURY = 5; //豪华型
    public static final Integer STATE_TOP_GRADE = 4; //高档型
    public static final Integer STATE_LOVERS = 3; //情侣酒店
    public static final Integer STATE_YOUTH_HOSTEL= 2; //青年旅社
    public static final Integer STATE_HOME = 1; //民宿

    private String name;

    private Region region;

    private BigDecimal price;

    private String coverUrl;

    private String intro;

    private Integer type = STATE_LUXURY;

    private String location;

    public String getTypeName() {
        String msg = "豪华型";
        if (type == STATE_TOP_GRADE) {
            msg = "高档型";
        } else if (type == STATE_LOVERS) {
            msg = "情侣酒店";
        }else if (type == STATE_YOUTH_HOSTEL) {
            msg = "青年旅社";
        }else if (type == STATE_HOME) {
            msg = "民宿";
        }
        return msg;
    }

    public String getJson() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("coverUrl", coverUrl);
        map.put("price", price);
        map.put("location", location);
        map.put("intro", intro);
        map.put("type", type);
        if (region != null){
            map.put("regionId",region.getId());
        }
        return JSONUtil.toJSONString(map);
    }
}